package gizwits.overseaair.way.schedule;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import gizwits.kit.Address;
import gizwits.kit.HttpKit;

public class add {
	public static final String uri = "/api/schedule/add";
	
	public static void main(String[] args) {
		Map<String, Object> params = new HashMap<>();
		params.put("userId", "f1fb53752dff46008795777775da7d5d");
		params.put("cycle", "y");
		params.put("timer", "19:00");
		params.put("weeks", "[1]");
		
		JSONArray objs = new JSONArray();
		JSONObject aObjs = new JSONObject();
		JSONArray devices = new JSONArray();
			JSONObject device = new JSONObject();
			device.put("deviceId", 631);
			JSONObject device2 = new JSONObject();
			device2.put("deviceId", 632);
			devices.add(device);
			devices.add(device2);
		aObjs.put("aid", -1);
		aObjs.put("devices", devices);
		objs.add(aObjs);
		params.put("objs", objs.toString());
		
		JSONObject control = new JSONObject();
		control.put("wind", "high");
		control.put("mode", "auto");
		control.put("temp", 23);
		params.put("control", control.toString());
		
		System.out.println(params);
		
		HttpKit.post(Address.air2+uri, params);
	}
	
}
